import React from 'react';
import { Image } from "antd-mobile";
import { useNavigate } from "react-router-dom";
import './cur.scss'
function ModuleShortCut({ data }) {
  let navigate = useNavigate();
  let match = /((uuid)=([\w]+)).((&rankType)=([\w]+))/g;
  let navFun = (k) => {
    if (k.p_action == 460) {
      let tempParam = match.exec(k.url)
      console.log(tempParam[3]);
      console.log(tempParam[6]);
      navigate("/Rank?uuid=" + tempParam[3] + "&rankType=" + tempParam[6])
    }
  }
  return (
    <ul className="module_shortCut">
      {data.shortCut.map((item, index) => (
        <li key={index} onClick={() => navFun(item)}>
          <Image src={item.cover}  lazy={true} width="10vw" height="10vw" style={{ borderRadius: "50%" }} fit="fill" />
          <h5>{item.name}</h5>
        </li>
      ))}
    </ul>
  );
}

export default ModuleShortCut;